﻿using System;
using System.IO;
using UnityEngine;
using VitServer;
using ProtoBuf;

namespace protoNet
{
    public class Deserialize
    {
        private MemoryStream stream;

        public Deserialize(byte[] _buffer)
        {
            stream = new MemoryStream(_buffer);
            stream.Position = 0;
        }
        


        // 解析服务器返回的ID_S2C_NOTICE
        public MsgNoticeRep DeserializeID_S2C_NOTICE()
        {
            MsgNoticeRep result = Serializer.Deserialize<MsgNoticeRep>(stream);
            return result;
        }

        // 解析服务器返回的ID_S2C_LOGIN
        public MsgLoginRep DeserializeID_S2C_LOGIN()
        {
            MsgLoginRep result = Serializer.Deserialize<MsgLoginRep>(stream);
            return result;
        }
        // 解析服务器返回的ID_C2S_ACCOUNT
        public MsgAccountReq DeserializeID_C2S_ACCOUNT()
        {
            MsgAccountReq result = Serializer.Deserialize<MsgAccountReq>(stream);
            return result;
        }
        // 解析服务器返回的ID_C2S_REGISTER
        public MsgRegisterReq DeserializeID_C2S_REGISTER()
        {
            MsgRegisterReq result = Serializer.Deserialize<MsgRegisterReq>(stream);
            return result;
        }
        // 解析服务器返回的ID_S2C_ERROR_CODE
        public MsgErrorCodeRep DeserializeID_S2C_ERROR_CODE()
        {
            MsgErrorCodeRep result = Serializer.Deserialize<MsgErrorCodeRep>(stream);
            return result;
        }
        // 解析服务器返回的ID_S2C_LOGIN_LOBBY
        public MsgLoginLobbyRep DeserializeID_S2C_LOGIN_LOBBY()
        {
            MsgLoginLobbyRep result = Serializer.Deserialize<MsgLoginLobbyRep>(stream);
            return result;
        }

    }
}
